<?php
include "cnx.php";
require_once('.\libs\Smarty-3.1.14\libs\Smarty.class.php');

require_once "ClassAllocine.php";
require_once "ClassMovie.php";
require_once "ClassMovieDetail.php";

ini_set('memory_limit', '500M');
ini_set ('max_execution_time', 0);

$smarty = new Smarty();
$version = '5.0';

if(isset($_GET["DEBUG"]) && $_GET["DEBUG"]==1){
	$debug = true;
}else{
	$debug = false;
}

$listMovie = Movie::getListMovie(null, $debug);
$listMovieDetails = array();
foreach ($listMovie as $movie) {		
	$movie->getMovieDetails();	
	$listMovieDetails = array_merge($movie->listMovieDetails,$listMovieDetails);
}
$listMovieDetails = array_reverse($listMovieDetails);

$smarty->assign("version",$version);
$smarty->assign("listeFilmsDetails",$listMovieDetails);
$smarty->display('index.tpl');

?>

    